// pages/guide/guide.js
var util = require("../../utils/util.js")
var api = require("../../utils/api.js")
var app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        userid: '',
        userid2: '',
        type: 29,
        articelinfo: {},
        articelist: {},
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        var that = this;
        let data = { type: that.data.type }
        let url = app.globalData.resBaseUrl + app.u.ARTICELIST
        api.requestUrl(data, url).then(res => {
            if (res.code == 200) {
                that.setData({
                    articelist: res.data,
                })
            } else {
                that.setData({
                    articelist: [],
                })
            }
        })

    },
    userid: function(e) {
        var that = this;
        that.setData({
            userid: e.target.id
        })
        wx.navigateTo({
            url: '../thetext/thetext?id=' + e.target.id,
        })
    },
    tableCheck: function(e) {
        var that = this;
        that.setData({
            type: 29,
        })
        let data = { type: that.data.type }
        let url = app.globalData.resBaseUrl + app.u.ARTICELIST
        api.requestUrl(data, url).then(res => {
            if (res.code == 200) {
                that.setData({
                    articelist: res.data,
                })
            } else {
                that.setData({
                    articelist: [],
                })
            }

        })

    },
    tableCheck1: function(e) {
        var that = this;
        that.setData({
            type: 31,
        })
        let data = { type: that.data.type }
        let url = app.globalData.resBaseUrl + app.u.ARTICELIST
        api.requestUrl(data, url).then(res => {
            if (res.code == 200) {
                that.setData({
                    articelist: res.data,
                })
            } else {
                that.setData({
                    articelist: [],
                })
            }
        })
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {
        wx.showShareMenu({
            withShareTicket: true
        })
    },
})